package com.javapatterns.decorator.print.copy;

import java.util.ArrayList;
import java.util.List;

abstract public class CopyOrder {
	protected String customer;
	protected String saleDate;
	List<OrderItem> items = new ArrayList<OrderItem>();

	public void print() {
		System.out.println("Item\tUnits\tUnit Price\tSubtotal");
		for (OrderItem item : items) {
			item.print();
		}
	}

	public double getTotal() {
		double total = 0.0;

		for (OrderItem item : items) {
			total += item.getSubTotal();
		}
		return total;
	}

	public String getCustomer() {
		return customer;
	}

	public void setCustomer(String customer) {
		this.customer = customer;
	}

	public String getSaleDate() {
		return saleDate;
	}

	public void setSaleDate(String saleDate) {
		this.saleDate = saleDate;
	}

	public List<OrderItem> getItems() {
		return items;
	}

	//
	// public void setItems(List<OrderItem> items) {
	// this.items = items;
	// }

	public void addItems(OrderItem item) {
		items.add(item);
	}

}
